<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<div id="app">
		<ul>
			<li v-for="(item,index) in dataList":key="item.id">
				{{item.id}}
				<button @click="delID(index)">删除</button>
			</li>
		</ul>
		<button @click="generate">生成</button>
		<script src="./vue.js"></script>
		<script>
			const app = new Vue({
				el:'#app',
				data:{
					dataList:[{id:1},{id:2},{id:3}],
				},
				methods:{
					generate(){
						this.dataList.push({id:Math.floor(Math.random()* 20)});
					},
					delID(index){
						this.dataList.splice(index,1)
					}
				}
			})
		</script>
	</div>
	
</body>
</html>